package org.wang.portal.tool;

/**
 * @author: wangchao
 * @Date: 2025/2/11 08:55
 * @Description: KafkaManager
 * @since 7.0.0
 **/

import org.wang.portal.util.ShellUtil;


public class KafkaManager {
    public void installKafka() {
        ShellUtil.executeScript("scripts/install_kafka.sh");
    }

    public void startKafka() {
        ShellUtil.executeCommand("kafka-server-start.sh config/server.properties");
    }

    public void stopKafka() {
        ShellUtil.executeCommand("kafka-server-stop.sh");
    }

    public void executeAction(String action) {
        if ("start".equalsIgnoreCase(action)) {
            startKafka();
        } else if ("stop".equalsIgnoreCase(action)) {
            stopKafka();
        }
    }
}